#include <iostream>

#include <memory>
#include "TcpServer.hpp"


//using func_t = std::function<void(int sockfd,std::string message,const InetAddr& who)>;

void Usage(const std::string& tip)
{
    std::cout << "Please Use:\n\t" << tip << " local_port\n" << std::endl;
}

int main(int argc,char* argv[])
{
    if(argc !=2)
    {
        Usage(argv[0]);
        exit(USAGE_ERROR);
    }
    
    EnableScreen();

 
    uint16_t port = std::stoi(argv[1]);

    std::unique_ptr<TcpServer> usvr = std::make_unique<TcpServer>(port);
    usvr->InitServer();
    usvr->Loop();
}